package com.wk.jetpackdemo.db;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;

import com.wk.jetpackdemo.db.entities.Book;
import com.wk.jetpackdemo.db.entities.BookUser;
import com.wk.jetpackdemo.db.entities.Loan;

import java.util.List;

@Dao
public interface BookDao {
    @Query("SELECT * FROM book_user")
    LiveData<List<BookUser>> getAllUsers();

    @Query("SELECT * FROM book")
    LiveData<List<Book>> getAllBooks();

    @Query("SELECT * FROM loan")
    LiveData<List<Loan>> getAllLoans();

    @Insert
    long insertBook(Book book);

    @Insert
    long  insertUser(BookUser user);

    @Insert
    long insertLoan(Loan loan);
}
